package com.tao

import android.annotation.SuppressLint
import android.content.ContentProvider
import android.content.ContentValues
import android.content.Context
import android.database.Cursor
import android.net.Uri

/**
 * 提供context
 */
@SuppressLint("StaticFieldLeak")
class ContextProvider : ContentProvider(){

    companion object {
        //  Get Context at anywhere
        lateinit var context: Context

        private fun setContextInstance(context: Context) {
            this.context = context
        }
    }

    override fun onCreate(): Boolean {
        setContextInstance(context!!)
        return true
    }

    override fun query(
        uri: Uri, strings: Array<String>?, s: String?, strings1: Array<String>?,
        s1: String?
    ): Cursor? {
        return null
    }

    override fun getType(uri: Uri): String? {
        return null
    }

    override fun insert(uri: Uri, contentValues: ContentValues?): Uri? {
        return null
    }

    override fun delete(uri: Uri, s: String?, strings: Array<String>?): Int {
        return 0
    }

    override fun update(
        uri: Uri,
        contentValues: ContentValues?,
        s: String?,
        strings: Array<String>?
    ): Int {
        return 0
    }
}